package com.dxy.lc.utils;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
public class EventUtil {

    private static ApplicationEventPublisher eventPublisher;

    public EventUtil(ApplicationEventPublisher eventPublisher) {
        EventUtil.eventPublisher = eventPublisher;
    }

    /**
     * 发布事件
     * @param event
     */
    public static void publishEvent(ApplicationEvent event){
        eventPublisher.publishEvent(event);
    }
}
